package com.projectzqjz.parttimework.ui.activity;

import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.projectzqjz.parttimework.App;
import com.projectzqjz.parttimework.R;
import com.projectzqjz.parttimework.base.BaseActivity;
import com.projectzqjz.parttimework.utils.AppConfig;
import com.projectzqjz.parttimework.utils.DataCleanManager;
import com.projectzqjz.parttimework.utils.ScreenUtil;
import com.projectzqjz.parttimework.utils.TitleBuilder;
import com.projectzqjz.parttimework.widget.CenterDialog;

import butterknife.BindView;
import butterknife.OnClick;


public class PartSettingActivity extends BaseActivity {
    @BindView(R.id.tv_hc)
    TextView tv_hc;

    @Override
    public void setListen() {

    }

    @OnClick({R.id.rel_clear, R.id.rel_pp, R.id.rel_connectM, R.id.rel_logOut})
    public void onViewClicked(View view) {
        if (ScreenUtil.isFastClick()) {
            return;
        }
        switch (view.getId()) {
            case R.id.rel_clear: //清除缓存
                new CenterDialog(R.layout.prompt_dialog, PartSettingActivity.this).clearMemory("确定清楚缓存？", tv_hc);
                break;
            case R.id.rel_pp://用户协议
              startActivity(new Intent(this,PartWebCommonActivity.class)
              .putExtra("url", "http://jzs.uprftk.cn:8080/xrk-job/index.html#/UserAgreement")
              .putExtra("title","用户协议"));
                break;
            case R.id.rel_connectM://隐私政策
                startActivity(new Intent(this,PartWebCommonActivity.class)
                        .putExtra("url", "http://jzs.uprftk.cn:8080/xrk-job/index.html#/protocol")
                        .putExtra("title","隐私政策"));
                break;
            case R.id.rel_logOut://退出登录
                new CenterDialog(R.layout.prompt_dialog, PartSettingActivity.this).showPrompt("确认退出？");
                break;
        }
    }

    @Override
    public void setTitleBarColor() {

    }

    @Override
    public int intiLayout() {
        return R.layout.activity_part_setting;
    }

    @Override
    public void initView() {
        try {
            tv_hc.setText(DataCleanManager.getTotalCacheSize(App.getContext()));
        } catch (Exception e) {
            e.printStackTrace();
        }
        new TitleBuilder(this).setTitleText("设置")
                .setLeftIcoListening(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        finish();
                    }
                });
    }

    @Override
    public void initData() {

    }

    @Override
    protected boolean isStatusBarBlack() {
        return true;
    }
}
